<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>课件管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {


			$("#btnCheckAll").click(function () {
				$("[name = ckbID]:checkbox").attr("checked", true);
			});
			$("#btnCheckNone").click(function () {
				$("[name = ckbID]:checkbox").attr("checked", false);
			});
			$("#btnCheckReverse").click(function () {
				$("[name = ckbID]:checkbox").each(function () {
					$(this).attr("checked", !$(this).attr("checked"));
				});
			});
			$("#btnCheckSubmit").click(function () {
				var result = new Array();
				$("[name = ckbID]:checkbox").each(function () {
					if ($(this).is(":checked")) {
						result.push($(this).attr("value"));
					}
				});
				$("#searchForm").attr('action', "${ctx}/resource/resourceCourseware/deleteAdd");
				$("#ids").val(result.join(","));
				$("#searchForm").submit();
				top.$('.jbox-body .jbox-icon').css('top', '55px');
			});



		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/resource/resourceCourseware/">课件列表</a></li>
		<shiro:hasPermission name="resource:resourceCourseware:edit"><li><a href="${ctx}/resource/resourceCourseware/form">课件添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="resourceCourseware" action="${ctx}/resource/resourceCourseware/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>课件名称：</label>
				<form:input path="coursewareName" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>标签：</label>
				<form:input path="label" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>添加日期：</label>
				<input name="beginCreateDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${resourceCourseware.beginCreateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/> - 
				<input name="endCreateDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${resourceCourseware.endCreateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li><label>课件属性：</label>
				<form:select path="coursewareAttribute" class="input-medium">
					<form:option value="" label="">===请选择===</form:option>
					<c:choose>
						<c:when test="${isSuperAdmin=='false'}">
							<form:option value="0">${fns:getDictLabel("0",'resource_courseware_attribute',"无")}</form:option>
						</c:when>
						<c:otherwise>
							<form:options items="${fns:getDictList('resource_courseware_attribute')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</c:otherwise>
					</c:choose>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>


				<li>
					<input id="ids" name="ids" type="hidden"/>
					<input id="btnCheckAll" class="btn btn-primary" type="button" value="全选"/>
					<input id="btnCheckNone" class="btn btn-primary" type="button" value="不全选"/>
					<input id="btnCheckReverse" class="btn btn-primary" type="button" value="反选"/>
					<input id="btnCheckSubmit" class="btn btn-primary" type="button" value="批量删除"/>
				</li>

			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>选择</th>
				<th>课件名称</th>
				<th>添加时间</th>
				<th>课件属性</th>
				<th>标签</th>
				<th>关联实验环境</th>
				<shiro:hasPermission name="resource:resourceCourseware:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="resourceCourseware">
			<tr>
				<td>
					<input name="ckbID" type="checkbox" value="${resourceCourseware.id}">
				</td>
				<td><a href="${ctx}/resource/resourceCourseware/form?id=${resourceCourseware.id}">
					${resourceCourseware.coursewareName}
				</a></td>
				<td>
					<fmt:formatDate value="${resourceCourseware.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
						${fns:getDictLabel(resourceCourseware.coursewareAttribute, 'resource_courseware_attribute', '')}
				</td>

				<td>
						${resourceCourseware.label}
				</td>
				<td>
					${resourceCourseware.environmentName}
				</td>

				<shiro:hasPermission name="resource:resourceCourseware:edit"><td>
					<a href="${ctx}/resource/resourceCourseware/detail?id=${resourceCourseware.id}">详情</a>
					<c:choose>
						<c:when test="${resourceCourseware.coursewareAttribute=='1'&&isSuperAdmin=='false'}">
							<a style="text-decoration: none; color: grey; pointer-events: none;">修改</a>
							<a style="text-decoration: none; color: grey; pointer-events: none;">删除</a>
						</c:when>
						<c:otherwise>
							<a href="${ctx}/resource/resourceCourseware/form?id=${resourceCourseware.id}">修改</a>
							<a href="${ctx}/resource/resourceCourseware/delete?id=${resourceCourseware.id}" onclick="return confirmx('确认要删除该课件管理吗？', this.href)">删除</a>
						</c:otherwise>
					</c:choose>

				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>